package com.wude.guild.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentPagerAdapter;

import com.wude.guild.fragment.PayPtbFragment;
import com.wude.guild.fragment.PayZheKouFragment;

/**
 * Created by LeBron on 2017/1/22.
 * 支付页面Adapter
 */

public class PayAdapter extends FragmentPagerAdapter {

    private PayPtbFragment payPtbFragment;
    private PayZheKouFragment payZheKouFragment;

    public PayAdapter(android.support.v4.app.FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        if (position == 0) {
            if (payPtbFragment == null) {
                payPtbFragment = new PayPtbFragment();
                return payPtbFragment;
            } else {
                return payPtbFragment;
            }
        } else if (position == 1) {
            if (payZheKouFragment == null) {
                payZheKouFragment = new PayZheKouFragment();
                return payZheKouFragment;
            } else {
                return payZheKouFragment;
            }
        } else {
            return null;
        }
    }

    @Override
    public int getCount() {
        return 2;
    }
}
